%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
{sub_dirs, ["rel", "apps/riak"]}.

{require_otp_vsn, "20"}.
{cover_enabled, true}.

%% TODO: nowarn_export_all on for now.
{erl_opts, [nowarn_export_all,
  		debug_info %% , fail_on_warning
		]}.
{eunit_opts, [verbose]}.

{deps, [
        {lager_syslog, {git, "git://github.com/basho/lager_syslog.git", {branch, "develop-3.0"}}},
        {cluster_info, {git, "git://github.com/basho/cluster_info.git", {branch, "develop-3.0"}}},
        {riak_kv, {git, "git://github.com/basho/riak_kv.git", {branch, "develop-3.0"}}},
        {riak_auth_mods, {git, "git://github.com/basho/riak_auth_mods.git", {branch, "develop-3.0"}}},
        {riak_repl, {git, "git://github.com/basho/riak_repl.git", {branch, "develop-3.0"}}},
        {yokozuna, {git, "git://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}}
      ]}.

{project_plugins, [
    {rebar3_cuttlefish, {git, "https://github.com/martincox/rebar3_cuttlefish", {branch, "fix/runner_dirs"}}}
]}.

{cuttlefish, [
    {file_name, "riak.conf"},
    {disable_bin_scripts, true},
    {schema_discovery, true},
    {schema_order, [
        riak,
        erlang_vm,
        riak_core,
        riak_api,
        riak_kv,
        riak_sysmon,
        bitcask,
        bitcask_multi,
        eleveldb,
        eleveldb_multi,
        multi_backend
    ]}
]}.

{relx, [{release, {riak, "3.0"},
    [kernel,
     stdlib,
     lager,
     lager_syslog,
     sasl,
     public_key,
     ssl,
     exometer_core,
     riak_sysmon,
     os_mon,
     crypto,
     runtime_tools,
     xmerl,
     mochiweb,
     webmachine,
     basho_stats,
     bitcask,
     clique,
     riak_core,
     riak_pipe,
     riak_kv,
     riak_api,
     riak_repl,
     cluster_info,
     yokozuna,
     riak_auth_mods]},

    {dev_mode, false},
    {include_erts, true},

    {overlay, [
         {mkdir, "lib/patches"},
         {mkdir, "data/ring"},

         {template, "rel/files/advanced.config", "etc/advanced.config"},

         %% Copy additional bin scripts
         {template, "rel/files/riak-admin",        "bin/riak-admin"},
         {template, "rel/files/riak-debug",        "bin/riak-debug"},
         {template, "rel/files/riak-chkconfig",    "bin/riak-chkconfig"},
         {template, "rel/files/riak-repl",         "bin/riak-repl"},

         {copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"},
         {copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"}

    ]},

    {generate_start_script, true},
    {extended_start_script, true},
    {extended_start_script_extensions, [
        {admin, "riak-admin"},
        {debug, "riak-debug"},
        {repl, "riak-repl"},
        {chkconfig, "riak-chkconfig"}
    ]},


    {extended_start_script_hooks,
     [ {pre_start,
        [{custom, "hooks/riak_not_running"},
         {custom, "hooks/check_ulimit"}]},
      {post_start,
       [{wait_for_process, riak_core_node_watcher}
       ]}
     ]}
]}.

{dialyzer, [{plt_apps, all_deps}]}.

{profiles, [
    {rel, [
        {relx, [
          {overlay_vars, "rel/vars.config"}
        ]}
    ]},
    {dev, [
        {relx, [
                {dev_mode, true}
        ]}
    ]},
    {rpm, [
        {relx, [
            {overlay_vars, "rpm.vars.config"},
            {overlay, [
                {template, "rel/pkg/rpm/riak", "usr/bin/riak"}
            ]}
        ]}
    ]},
    {deb, [
        {relx, [
            {overlay_vars, "deb.vars.config"}
        ]}
    ]}
]}.
